home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Snippets / Development Tools & Languages / AEGestalt / UGrayFillAdorner.cp < prev    next >
Encoding:
Text File  |  1995-02-12  |  1.2 KB  |  65 lines  |  [TEXT/MPS ]

  1. //     Copyright © 1991-92 Apple Computer, Inc. All rights reserved.
  2. //     UGrayfillAdorner.cp
  3. //    Kent Sandvik DTS
  4. //    This file is used for specifying the TGrayFill member functions,
  5. //    i.e. drawing gray in the views in forms of an adorner.
  6. //
  7. //    <1>        khs        1.0        First final version
  8.  
  9.  
  10. #ifndef __UGRAYFILLADORNER__
  11. #include "UGrayfillAdorner.h"
  12. #endif
  13.  
  14. //    Globals
  15. // Setup the KS-look&feel gray global
  16. CRGBColor gKSRGBGray(36000,
  17.                      40500,
  18.                      37500);
  19.  
  20.  
  21. //    Empty constructor - for avoiding ptabs in global data space
  22.  
  23. #undef Inherited
  24. #define Inherited TAdorner
  25.  
  26. #pragma segment ARes
  27. DefineClass(TGrayFill, TAdorner);
  28.  
  29. TGrayFill::TGrayFill()
  30. {
  31. }
  32.  
  33.  
  34. //    Draw TGrayFill Adorner method
  35. #pragma segment ARes
  36. void TGrayFill::Draw(TView* itsView,
  37.                             const VRect&        /*area*/)
  38. {
  39.     CRGBColor saveColor;
  40.     PenState savePenState;
  41.     VRect adornArea;
  42.     CRect QDArea;
  43.     CRect tempRect;
  44.  
  45.     // save off the current pen state and the foreground color
  46.     GetPenState(&savePenState);
  47.     GetIfColor(saveColor);
  48.     PenNormal();
  49.  
  50.     // get area
  51.     itsView->GetAdornExtent(adornArea);
  52.     itsView->ViewToQDRect(adornArea, QDArea);
  53.     tempRect = QDArea;
  54.  
  55.     // colorize it
  56.     SetIfColor(gKSRGBGray);
  57.     PaintRect(tempRect);
  58.  
  59.     // restore the foreground color and the pen
  60.     SetIfColor(saveColor);
  61.     SetPenState(&savePenState);
  62. }
  63.  
  64.  
  65.